class ProbeSummary < Plugin

	attr_reader :total_probes, :unique_probes, :min, :max, :avg
	
	def initialize
		@total_probes = 0
		@unique_probes = 0

		@max = nil
		@min = nil
		@total = 0
	end

	def push_gene(gene)
		gene.probes.values.each do |p|
			@total_probes += p.probes
			@total += p.probe_value
			(@max) ? 
				(@max = p.probe_value if p.probe_value > @max) : 
				@max = p.probe_value
			(@min) ? 
				(@min = p.probe_value if p.probe_value < @min) : 
				@min = p.probe_value
		end

		@unique_probes += gene.probes.size


	end

	def finalize
		@avg = @total_probes.zero? ? 0 : @total / @total_probes
	end

	def to_s
		s = 	"---PROBE NAME SUMMARY---\n"
		s += 	"#{@unique_probes} out of #{@total_probes} were unique\n"
		s +=	"Min: #{@min}\tMax: #{@max}\tAvg:#{@avg}\n"
	end

end
